import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import Components from 'unplugin-vue-components/vite';
import { VantResolver } from '@vant/auto-import-resolver';
import pptv from "postcss-px-to-viewport-8-plugin";

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    vue(),
    Components({
      resolvers: [VantResolver()],
    }),
  ],
  css: {
    postcss: {
      plugins: [pptv({
        unitToConvert: 'px',
        viewportWidth: 375,
        viewportUnit: 'vw',
        landscape: true,
        landscapeUnit: 'vh',
        landscapeWidth: 375,
      })]
    }
  },
  server:{
    proxy:{
      "/api":{
        target:"https://lottery.zunaer.com",
        changeOrigin:true,
        secure: false,
        ws: true,
        rewrite: path => path.replace(/^\/api/, '/api')
      }
    }
  }
})
